//
//  GlobalConfig.swift
//  MiU
//
//  Created by linhan on 15/11/7.
//  Copyright © 2015年 MiU. All rights reserved.
//

import Foundation


#if DEBUG
let API_BASE_PATH:String = "https://api.bbyiya.net"
#else
let API_BASE_PATH:String = "https://api.bbyiya.net"
#endif


func trace(_ values: Any...)
{
    #if DEBUG
        for value in values
        {
            print(value)
        }
    #endif
}

struct SW
{
    struct Config
    {
        
        static let APP_STORE_URL:String = "https://itunes.apple.com/us/app/apple-store/id1000397315?mt=8"
        
        static let Invitation_Text:String = ">> http://t.cn/RUW1DMc下载"
        
        //获取验证码冷却时间
        static let GetVerifyCodeCDTime:Double = 30
        
        static let LaunchAnimationTime:Double = 2.2
        
        static let WeiboAppKey:String = "3093333898"
        
        static let WechatAppID:String = "wxfcd7fab4005cb1ee"
        static let WechatAppSecret:String = "e06abcfe20159ca48a5f0e1fe6148324"
        
        //12photo
        //static let WechatAppID:String = "wxcc101e7b17ed868e"
        //static let WechatAppSecret:String = "af5357b12453ed6a0ae6aba1eb64c3dd"
        
        static let QQAppID:String = "1105472633"
        
        static let UmengAppID:String = "56fcd054e0f55adc8d001da7"
        
        static let KeychainAccessGroup:String = "M24L6NAZ74.com.mige.keychain"
        
        static let JPushAppKey:String = "59ad3445352de498657075ed"
        
        static let RequestSecKey:String = "b8ceb32c-f2a9-4d25-8e2b-6a574017d119"
        
        static let DefaultKidsName:String = "咿呀宝贝"
        
        static let DefaultAlbumName:String = "咿呀相册"
        
        //每个事件最大图片收藏数量
        static let MaxFavoritePhotoCount:Int = 12
        
        //单倍分辨率下的默认最优尺寸
        static let ProcessImagePresetOriginSize:CGSize = CGSizeMake(2448, 2448)
        
        //不同设备下默认最优尺寸
        static var ProcessImagePresetSize:CGSize{
            return convertToRetina(ProcessImagePresetOriginSize)
        }
        
        //预览图尺寸(单倍分辨率下的尺寸)
        static let PreviewImageOriginSize:CGSize = CGSizeMake(640, 640)
        
        //缩略图尺寸(事件列表中只使用缩略图，单倍分辨率下的尺寸)
        static let ThumbnailImageOriginSize:CGSize = CGSizeMake(200, 200)
        
        
        
        //书本摊开尺寸
        static var BookFullPageSize:CGSize = CGSizeMake(5196, 3543)
        //
        static var BookSinglePageSize:CGSize = CGSizeMake(2598, 3543)
        //双倍分辨率
        static var BookSinglePagePreviewSize:CGSize = CGSizeMake(911, 1242)
        //每个产品（书）最大数量
        static let MaxPageCountPerProduct:Int = 20
        
        
        private static func convertToRetina(_ size:CGSize) -> CGSize
        {
            let scale:CGFloat = UIScreen.main.scale
            return CGSizeMake(size.width / scale, size.height / scale)
        }
        
        struct Template
        {
            static let FontSize:CGFloat = 10
            static let TextLeading:CGFloat = 3
            //static let TextColor:CGFloat = 16
        }
        
        //默认图片存储基路径
        static let DefaultImageStoreBaseURL:String = "http://pic.bbyiya.com"
        private static var _imageStoreBaseURL:String = ""
        static var imageStoreBaseURL:String
        {
            get{
                return _imageStoreBaseURL ??? DefaultImageStoreBaseURL
            }
            set{
                _imageStoreBaseURL = newValue
            }
        }
        
        //WIFI下自动同步照片
        static var autoUploadOnWifi:Bool{
            get{
                return SimpleCookie.shared().getObject(CookieKey.autoUploadOnWifi) as? Bool ?? true
            }
            set{
                SimpleCookie.shared().setObject(newValue, forKey: CookieKey.autoUploadOnWifi)
            }
        }
        
        //是否记录文档浏览记录
        static var musicPlayableOnCellular:Bool{
            get{
                return SimpleCookie.shared().getObject(CookieKey.musicPlayableOnCellular) as? Bool ?? false
            }
            set{
                SimpleCookie.shared().setObject(newValue, forKey: CookieKey.musicPlayableOnCellular)
            }
        }
        
        
        
    }
    
    struct ViewTag {
        
        static let LoginViewController:Int = 111
        
    }
}





